import { ProColumns } from '@ant-design/pro-table'
const statusEnum = {
    0: { color: 'green', text: '正常' },
    1: { color: 'volcano', text: '停用' },
    2: { color: 'red', text: '黑名单' },
}
export const columns: ProColumns<IT.IUser>[] = [
    { title: '#', dataIndex: 'index', valueType: 'index', width: 30 },
    { title: '头像', dataIndex: 'avatar', hideInSearch: true, valueType: 'avatar', width: 45 },
    { title: '编号', dataIndex: 'userid', hideInSearch: true, width: 50 },
    { title: '账号', dataIndex: 'account', hideInSearch: true, width: 60, ellipsis: true },
    { title: '姓名', dataIndex: 'name', width: 80, ellipsis: true },
    { title: '电话', dataIndex: 'phone', width: 110 },
    { title: '性别', dataIndex: 'sex', hideInSearch: true, width: 45 },
    { title: '状态', dataIndex: 'status', valueType: 'select', valueEnum: statusEnum, width: 60 },
    {
        title: '角色',
        dataIndex: 'role',
        renderText: (_, r) => r.role?.roleName,
        width: 80,
        ellipsis: true,
    },
    {
        title: '设备账号',
        dataIndex: 'share',
        renderText: (_, r) => r.share?.shareName,
        width: 100,
        ellipsis: true,
    },
    {
        title: '所属企业',
        dataIndex: 'company',
        renderText: (_, r) => r.company?.companyName,
        width: 100,
        ellipsis: true,
    },
    { title: '创建人', dataIndex: 'au', hideInSearch: true, width: 60, ellipsis: true },
    { title: '创建时间', dataIndex: 'ct', hideInSearch: true, width: 60, ellipsis: true },
    { title: '更新人', dataIndex: 'ed', hideInSearch: true, width: 60, ellipsis: true },
    { title: '更新时间', dataIndex: 'ut', hideInSearch: true, width: 60, ellipsis: true },
]
